let fs = require("fs");
let data = '我是测试 nodejs stream 的 文本数据';

let writerStream = fs.createWriteStream('output.txt');

writerStream.write(data,'utf-8');

writerStream.end();

writerStream.on('finish',()=>{
  console.log('流事件写入完毕');
})
writerStream.on('error',(err)=>{
  console.log(err.stack);
})

console.log('程序执行完毕');
